local bubai = fk.CreateSkill{
    name = "ym1__bubai",
}
Fk:loadTranslationTable{
    ["ym1__bubai"] = "布白",
    [":ym1__bubai"] = "出牌阶段限一次，你可以将手牌向四调整一，结束并跳过你本回合的阶段。",
    ["@@ym1__bubai-turn"] = "跳过阶段",
}
bubai:addEffect("active",{
    max_phase_use_time = 1,
    can_use = function (self, player)
        return self:withinTimesLimit(player,Player.HistoryPhase) and player:getHandcardNum() ~= 4
    end,
    card_num = 0,
    target_num = 0,
    card_filter = Util.FalseFunc,
    target_filter = Util.FalseFunc,
    on_use = function (self, room, effect)
        local player = effect.from
        if player:getHandcardNum() > 4 then
            room:askToDiscard(player,{
                max_num = 1,
                min_num = 1,
                cancelable = false,
                pattern = ".",
                skill_name = bubai.name
            })
        elseif player:getHandcardNum() < 4 then
            player:drawCards(1,bubai.name)
        end
        room:setPlayerMark(player,"@@ym1__bubai-turn",1)
        if player.phase ~= player.NotActive then
            player:endCurrentPhase()
        end
    end,
})
bubai:addEffect(fk.EventPhaseChanging, {
    mute = true,
    is_delay_effect = true,
    can_trigger = function(self, event, target, player, data)
        return target == player and player:getMark("@@ym1__bubai-turn") ~= 0 and not data.skipped
    end,
    on_use = function (self, event, target, player, data)
        data.skipped = true
    end,
})
return bubai